package cn.ad.enumration;

import java.util.Map;

public enum Gender {
    MALE("Male",1),  //男性
    FEMALE("Female",2);//女性

    private String name;
    private int value;
    
    private static java.util.HashMap<String,Integer> mappings;

    private synchronized static java.util.HashMap<String, Integer> getMappings() {
        if (mappings == null) {
            mappings = new java.util.LinkedHashMap<String, Integer>();
            for (Gender format : Gender.values()) {
                mappings.put(format.name, format.value);
            }
        }
        return mappings;
    }

    private Gender(String name, int value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

	public int getValue() {
		return value;
	}
	 public static Map<String,Integer> getMapping(){
	        return getMappings();
	 }
}
